package com.rocketmq.consumer;

import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * 异步消息测试
 * @author ytj
 * @date 2024/10/10 15:56
 */
@Component
@RocketMQMessageListener(consumerGroup = "boot-product",topic = "asy_test",messageModel = MessageModel.BROADCASTING)
public class AsyMessageTest implements RocketMQListener<MessageExt> {
    @Override
    public void onMessage(MessageExt messageExt) {
        System.out.println("接收到异步消息:"+new String(messageExt.getBody())+",时间为:"+System.currentTimeMillis());
    }
}
